﻿@page "/gantt-chart/scheduling-mode"

@using Syncfusion.Blazor.Gantt
@using BlazorDemos



@inherits SampleBaseComponent;


<SampleDescription>
    <p>
        The Gantt provides support for automatic and manual task scheduling modes. Scheduling mode of a task is used to indicate whether the start and end dates of a task will be automatically validated or not. Using the property <code>TaskMode</code> we can able to change the scheduling mode of a task. The following are the enumeration values that can be set to the property <code>TaskMode</code>.
    <p> •	Auto</p>
    <p> •	Manual</p>
    <p>•	Custom</p>
    </p>
</SampleDescription>
<ActionDescription>
    <p>When the <code>TaskMode</code> property is set as Auto scheduling mode, all the tasks in the project will be rendered as automatically scheduled tasks. Thus the start and end dates of the tasks in the project will be automatically validated.</p>
    <p>When the <code>TaskMode</code> property is set as Manual scheduling mode, all the tasks in the project will be rendered with given dates on every tasks. Thus the dates of the tasks will not get validated automatically by the system.</p>
    <p>When the <code>TaskMode</code> property is set as Custom, the scheduling mode for each tasks will be mapped form the data source field. The property <code>Manual</code> is used to map the scheduling mode field from the data source.</p>


</ActionDescription>

<div class="col-lg-12 control-section">
    <div class="content-wrapper">
        <div class="row">
            <SfGantt DataSource="@TaskCollection" Height="450px" Width="100%" ProjectStartDate="@ProjectStart" ProjectEndDate="@ProjectEnd" TaskMode="ScheduleMode.Custom">
                <GanttTaskFields Id="TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate" Duration="Duration" Progress="Progress" ParentID="ParentId" Manual="IsManual">
                </GanttTaskFields>
                <GanttLabelSettings LeftLabel="TaskName" TValue="ScheduleData.TaskData"></GanttLabelSettings>
                <GanttSplitterSettings Position="30%"></GanttSplitterSettings>
            </SfGantt>
        </div>
    </div>
</div>


@code{


    public DateTime ProjectStart = new DateTime(2019, 3, 27);
    public DateTime ProjectEnd = new DateTime(2019, 7, 6);
    public List<ScheduleData.TaskData> TaskCollection { get; set; }


    protected override void OnInitialized()
    {
        this.TaskCollection = ScheduleData.GetTaskCollection();
    }
}
